-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add points on completing quest and achievement #128
Conversation
src/utils.rs
Outdated
} | ||
|
||
// get total experience for a specific quest id from quest collection | ||
let quests_collection: Collection<QuestDocument> = self.db.collection("quests"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please try to minimize the amount of queries you do. For example you can use facets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/utils.rs
Outdated
let mut result = true; | ||
|
||
// get completed tasks for a specific quest id from completed_tasks collection | ||
for &item in total_tasks.iter() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing you can do is an aggregation to get the amount of tasks associated to a quest and the amount completed by the user, and check if those are equal, if so it means the user completed the quest. If you can do it in the same query which completes the task, that would be perfect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
closes #100
closes #99